/*  yALB - Yet Another List Builder. Roster Editor for Wargames/tabletop games.
    Copyright (C) 2008-2012  Daniel Ricardo Castro Alvarado

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.*/

#ifndef LISTSETTINGS_H
#define LISTSETTINGS_H

#include <QDialog>
#include <QHash>

struct FileAndName {
    QString file;
    QString name;

    inline bool operator ==(const FileAndName& b) const {
        return this->file == b.file;
    }
};

namespace Ui {
    class ListSettings;
}

class ListSettings : public QDialog
{
    Q_OBJECT

public:
    explicit ListSettings(QWidget *parent = 0);
    ~ListSettings();

    void addGame(const FileAndName& gameFile, const QList<FileAndName>& armies);

    uint getListPoints() const;
    QString getCurrentGameFile() const;
    QString getCurrentArmyFile() const;
    QString getListToOpen() const;

    void setListPoints(uint points);
    void setCurrentArmyFile(const QString& armyFile);
    void setCurrentGameFile(const QString& gameFile);

private:
    Ui::ListSettings *ui;

    QHash<QString, QList<FileAndName> > gameArmies;
    QString listToOpen;

private slots:
    void on_buttonBox_accepted();
    void on_buttonBox_rejected();
    void on_gameBox_currentIndexChanged(int index);
    void on_openListButton_clicked();
};

#endif // LISTOPTIONS_H
